﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MindASPCoreWebAPI.ApiProject.Controllers;
using MindASPCoreWebAPI.DtoModel.Common;
using MindASPCoreWebAPI.DtoModel.SystemManager;
using MindASPCoreWebAPI.PoModel.SystemManager;
using MindASPCoreWebAPI.Repository.CommonLib;
using MindASPCoreWebAPI.Service.SystemManager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MindASPCoreWebAPI.ApiProject.Area.SystemManager
{
   
    [ApiController]
    public class ClientAdminController : MyBaseController
    {

        
        public ClientAdminService _ClientAdminService;
        public ClientAdminController(ClientAdminService ClientAdminService)
        {
            _ClientAdminService = ClientAdminService;
        }
       /// <summary>
       /// 客户管理显示查询
       /// </summary>
       /// <param name="hang"></param>
       /// <param name="ka"></param>
       /// <param name="qu"></param>
       /// <param name="fen"></param>
       /// <param name="shi"></param>
       /// <param name="ad"></param>
       /// <param name="gong"></param>
       /// <param name="xname"></param>
       /// <param name="pageIndex"></param>
       /// <param name="pageSize"></param>
       /// <returns></returns>
        [HttpGet]
        public ResultModel<PagerResult<ClientAdminDto>> ClientAdminShow(int hang, int ka, int qu, int fen, int shi, int ad, string gong, string xname, int pageIndex, int pageSize)
        {
            try
            {
                var list = _ClientAdminService.ClientAdminShow(hang, ka, qu, fen, shi, ad, gong, xname, pageIndex, pageSize);
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
           

        }
        /// <summary>
        /// 行业下拉
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<IndustryAdminModel>> Inddown()
        {
            try
            {
                var list = _ClientAdminService.Inddown();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// ka下拉
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<KaModel>> Kadown()
        {
            try
            {
                var list = _ClientAdminService.Kadown();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 区域下拉
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<AreaModel>> Areadown()
        {
            try
            {
                var list = _ClientAdminService.Areadown();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 分级下拉
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<LevelModel>> Leveldown()
        {
            try
            {
                var list = _ClientAdminService.Leveldown();
                return MyOk(list);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 客户管理删除
        /// </summary>
        /// <param name="cust_id"></param>
        /// <returns></returns>
        /// 
        [HttpPost]
        public ResultModel<int> Cust_Delete(int cust_id)
        {
            var list = _ClientAdminService.Cust_Delete(cust_id);
            return MyOk(list);
        }
        /// <summary>
        /// 添加反填
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<ClientAdminDto>> Show(int cust_id)
        {
            var list = _ClientAdminService.Show(cust_id);
            return MyOk(list);
        }

        /// <summary>
        /// 公司性质下拉
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<NatModel>> Natdown()
        {
            var list = _ClientAdminService.Natdown();
            return MyOk(list);
        }

        /// <summary>
        /// 客户职位下拉
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<PosiModel>> Posidown()
        {
            var list = _ClientAdminService.Posidown();
            return MyOk(list);
        }
        /// <summary>
        /// 权力决策下拉
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<ActhModel>> Acthdown()
        {
            var list = _ClientAdminService.Acthdown();
            return MyOk(list);
        }

        /// <summary>
        /// 语言下拉
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ResultModel<List<LangModel>> Langdown()
        {
            var list = _ClientAdminService.Langdown();
            return MyOk(list);
        }
        /// <summary>
        /// 公司显示
        /// </summary>
        /// <returns></returns>
        /// [
        /// 
        [HttpGet]
        public ResultModel<List<CompanyAdminModel>> CompList(string comname)
        {
            var list = _ClientAdminService.CompList(comname);
            return MyOk(list);
        }
        /// <summary>
        /// 客户管理添加
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        /// 

        [HttpPost]
        public ResultModel<int> ClientAdd(CustAdminModel list)
        {
            var data = _ClientAdminService.ClientAdd(list);
            return MyOk(data);
        }
      /// <summary>
      /// 编辑反填
      /// </summary>
      /// <param name="cust_id"></param>
      /// <returns></returns>
        [HttpGet]
        public ResultModel<EditShow> EditeList(int cust_id)
        {
            var list = _ClientAdminService.EditeList(cust_id);
            return MyOk(list);

        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="cust"></param>
        /// <returns></returns>
        /// //
        /// 
        [HttpPost]
        public ResultModel<int> EditXiu(CustAdminModel cust)
        {
            var list = _ClientAdminService.EditXiu(cust);
            return MyOk(list);
        }
        /// <summary>
        /// 字典表
        /// </summary>
        /// <returns></returns>
        /// 
        [HttpGet]
        public ResultModel<List<DictiDto>> DictiShow(string dt_type_key)
        {
            return MyOk(_ClientAdminService.DictiShow( dt_type_key));
        }




    }
}
